package com.fourthGroup.service;

import com.fourthGroup.service.fallback.ProductServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import com.fourthGroup.config.FeignConfiguration;
import com.fourthGroup.model.Product;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import com.fourthGroup.service.fallback.ProductServiceFallback;

//@FeignClient(value = "service-product",configuration = FeignConfiguration.class)

// Feign 整合 Sentinel Fallback方式 | 降级
//@FeignClient(value = "service-product",configuration = FeignConfiguration.class
//,fallback = ProductServiceFallback.class)

// fallback factory 方式(使用)
@FeignClient(value = "service-product",configuration = FeignConfiguration.class
        ,fallbackFactory = ProductServiceFallbackFactory.class, qualifier = "ProductServiceFeign")
public interface ProductServiceFeign {
    @RequestMapping("/product/{pid}")
    Product queryProductById(@PathVariable("pid") Integer pid);
}
